package com.bs.action;

import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;
import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
public class ActionBase extends ActionSupport implements ServletResponseAware,ServletRequestAware,SessionAware {
	public HttpServletResponse response;
	public HttpServletRequest request;
	@SuppressWarnings("rawtypes")
	public Map session;
	
	public void setServletResponse(HttpServletResponse response) {
		response.setContentType("html/text");
		response.setCharacterEncoding("gb2312");
		this.response = response;
	}
	public void setServletRequest(HttpServletRequest request) {
		this.request = request;
	}
	public void setSession(@SuppressWarnings("rawtypes") Map session) {
		this.session = session;
	}
	
	public String successInfo(String string){
		return "{status:true, info:'"+string+"'}";
	}
	
	public String errorInfo(String string){
		return "{status:false, info:'"+string+"'}";
	}
	
	public String sysError(){
		return errorInfo("系统错误");
	}
}
